Integrand size = 30, antiderivative size = 98 \[ \int (e \sec (c+d x))^{4-2 n} (a+i a \tan (c+d x))^n \, dx=\frac {2 i a^2 (e \sec (c+d x))^{4-2 n} (a+i a \tan (c+d x))^{-2+n}}{d \left (6-5 n+n^2\right )}+\frac {i a (e \sec (c+d x))^{4-2 n} (a+i a \tan (c+d x))^{-1+n}}{d (3-n)} \]
[Out]
Time = 0.17 (sec) , antiderivative size = 98, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.067, Rules used = {3575, 3574} \[ \int (e \sec (c+d x))^{4-2 n} (a+i a \tan (c+d x))^n \, dx=\frac {2 i a^2 (a+i a \tan (c+d x))^{n-2} (e \sec (c+d x))^{4-2 n}}{d \left (n^2-5 n+6\right )}+\frac {i a (a+i a \tan (c+d x))^{n-1} (e \sec (c+d x))^{4-2 n}}{d (3-n)} \]
[In]
[Out]
Rule 3574
Rule 3575
Rubi steps \begin{align*} \text {integral}& = \frac {i a (e \sec (c+d x))^{4-2 n} (a+i a \tan (c+d x))^{-1+n}}{d (3-n)}+\frac {(2 a) \int (e \sec (c+d x))^{4-2 n} (a+i a \tan (c+d x))^{-1+n} \, dx}{3-n} \\ & = \frac {2 i a^2 (e \sec (c+d x))^{4-2 n} (a+i a \tan (c+d x))^{-2+n}}{d \left (6-5 n+n^2\right )}+\frac {i a (e \sec (c+d x))^{4-2 n} (a+i a \tan (c+d x))^{-1+n}}{d (3-n)} \\ \end{align*}
Time = 2.56 (sec) , antiderivative size = 91, normalized size of antiderivative = 0.93 \[ \int (e \sec (c+d x))^{4-2 n} (a+i a \tan (c+d x))^n \, dx=\frac {e^4 \sec ^2(c+d x) (e \sec (c+d x))^{-2 n} (\cos (2 (c+d x))-i \sin (2 (c+d x))) (a+i a \tan (c+d x))^n (-i (-4+n)+(-2+n) \tan (c+d x))}{d (-3+n) (-2+n)} \]
[In]
[Out]
\[\int \left (e \sec \left (d x +c \right )\right )^{4-2 n} \left (a +i a \tan \left (d x +c \right )\right )^{n}d x\]
[In]
[Out]
none
Time = 0.24 (sec) , antiderivative size = 134, normalized size of antiderivative = 1.37 \[ \int (e \sec (c+d x))^{4-2 n} (a+i a \tan (c+d x))^n \, dx=\frac {{\left ({\left (-i \, n + 3 i\right )} e^{\left (4 i \, d x + 4 i \, c\right )} + {\left (-i \, n + 4 i\right )} e^{\left (2 i \, d x + 2 i \, c\right )} + i\right )} \left (\frac {2 \, e e^{\left (i \, d x + i \, c\right )}}{e^{\left (2 i \, d x + 2 i \, c\right )} + 1}\right )^{-2 \, n + 4} e^{\left (i \, d n x + i \, c n - 4 i \, d x + n \log \left (\frac {2 \, e e^{\left (i \, d x + i \, c\right )}}{e^{\left (2 i \, d x + 2 i \, c\right )} + 1}\right ) + n \log \left (\frac {a}{e}\right ) - 4 i \, c\right )}}{2 \, {\left (d n^{2} - 5 \, d n + 6 \, d\right )}} \]
[In]
[Out]
\[ \int (e \sec (c+d x))^{4-2 n} (a+i a \tan (c+d x))^n \, dx=\int \left (e \sec {\left (c + d x \right )}\right )^{4 - 2 n} \left (i a \left (\tan {\left (c + d x \right )} - i\right )\right )^{n}\, dx \]
[In]
[Out]
Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 595 vs. \(2 (88) = 176\).
Time = 1.08 (sec) , antiderivative size = 595, normalized size of antiderivative = 6.07 \[ \int (e \sec (c+d x))^{4-2 n} (a+i a \tan (c+d x))^n \, dx=\frac {8 \, {\left ({\left (\cos \left (2 \, d x + 2 \, c\right )^{2} + \sin \left (2 \, d x + 2 \, c\right )^{2} + 2 \, \cos \left (2 \, d x + 2 \, c\right ) + 1\right )}^{\frac {1}{2} \, n} a^{n} e^{4} \cos \left (n \arctan \left (\sin \left (2 \, d x + 2 \, c\right ), \cos \left (2 \, d x + 2 \, c\right ) + 1\right )\right ) + i \, {\left (\cos \left (2 \, d x + 2 \, c\right )^{2} + \sin \left (2 \, d x + 2 \, c\right )^{2} + 2 \, \cos \left (2 \, d x + 2 \, c\right ) + 1\right )}^{\frac {1}{2} \, n} a^{n} e^{4} \sin \left (n \arctan \left (\sin \left (2 \, d x + 2 \, c\right ), \cos \left (2 \, d x + 2 \, c\right ) + 1\right )\right ) - {\left (a^{n} e^{4} n - 3 \, a^{n} e^{4}\right )} {\left (\cos \left (2 \, d x + 2 \, c\right )^{2} + \sin \left (2 \, d x + 2 \, c\right )^{2} + 2 \, \cos \left (2 \, d x + 2 \, c\right ) + 1\right )}^{\frac {1}{2} \, n} \cos \left (2 \, d x + n \arctan \left (\sin \left (2 \, d x + 2 \, c\right ), \cos \left (2 \, d x + 2 \, c\right ) + 1\right ) + 2 \, c\right ) + {\left (-i \, a^{n} e^{4} n + 3 i \, a^{n} e^{4}\right )} {\left (\cos \left (2 \, d x + 2 \, c\right )^{2} + \sin \left (2 \, d x + 2 \, c\right )^{2} + 2 \, \cos \left (2 \, d x + 2 \, c\right ) + 1\right )}^{\frac {1}{2} \, n} \sin \left (2 \, d x + n \arctan \left (\sin \left (2 \, d x + 2 \, c\right ), \cos \left (2 \, d x + 2 \, c\right ) + 1\right ) + 2 \, c\right )\right )}}{{\left ({\left (-i \, e^{2 \, n} n^{2} + 5 i \, e^{2 \, n} n - 6 i \, e^{2 \, n}\right )} 2^{n} \cos \left (6 \, d x + 6 \, c\right ) - 3 \, {\left (i \, e^{2 \, n} n^{2} - 5 i \, e^{2 \, n} n + 6 i \, e^{2 \, n}\right )} 2^{n} \cos \left (4 \, d x + 4 \, c\right ) - 3 \, {\left (i \, e^{2 \, n} n^{2} - 5 i \, e^{2 \, n} n + 6 i \, e^{2 \, n}\right )} 2^{n} \cos \left (2 \, d x + 2 \, c\right ) + {\left (e^{2 \, n} n^{2} - 5 \, e^{2 \, n} n + 6 \, e^{2 \, n}\right )} 2^{n} \sin \left (6 \, d x + 6 \, c\right ) + 3 \, {\left (e^{2 \, n} n^{2} - 5 \, e^{2 \, n} n + 6 \, e^{2 \, n}\right )} 2^{n} \sin \left (4 \, d x + 4 \, c\right ) + 3 \, {\left (e^{2 \, n} n^{2} - 5 \, e^{2 \, n} n + 6 \, e^{2 \, n}\right )} 2^{n} \sin \left (2 \, d x + 2 \, c\right ) + {\left (-i \, e^{2 \, n} n^{2} + 5 i \, e^{2 \, n} n - 6 i \, e^{2 \, n}\right )} 2^{n}\right )} d} \]
[In]
[Out]
\[ \int (e \sec (c+d x))^{4-2 n} (a+i a \tan (c+d x))^n \, dx=\int { \left (e \sec \left (d x + c\right )\right )^{-2 \, n + 4} {\left (i \, a \tan \left (d x + c\right ) + a\right )}^{n} \,d x } \]
[In]
[Out]
Time = 7.47 (sec) , antiderivative size = 174, normalized size of antiderivative = 1.78 \[ \int (e \sec (c+d x))^{4-2 n} (a+i a \tan (c+d x))^n \, dx=\frac {4\,e^4\,{\left (\frac {a\,\left (\cos \left (2\,c+2\,d\,x\right )+1+\sin \left (2\,c+2\,d\,x\right )\,1{}\mathrm {i}\right )}{\cos \left (2\,c+2\,d\,x\right )+1}\right )}^n\,\left (4\,\sin \left (2\,c+2\,d\,x\right )+\cos \left (2\,c+2\,d\,x\right )\,4{}\mathrm {i}+\cos \left (4\,c+4\,d\,x\right )\,1{}\mathrm {i}-n\,1{}\mathrm {i}+\sin \left (4\,c+4\,d\,x\right )-n\,\cos \left (2\,c+2\,d\,x\right )\,1{}\mathrm {i}-n\,\sin \left (2\,c+2\,d\,x\right )+3{}\mathrm {i}\right )}{d\,{\left (\frac {e}{\cos \left (c+d\,x\right )}\right )}^{2\,n}\,\left (4\,\cos \left (2\,c+2\,d\,x\right )+\cos \left (4\,c+4\,d\,x\right )+3\right )\,\left (n^2-5\,n+6\right )} \]
[In]
[Out]